import java.awt.image.renderable.ParameterBlock;

import javax.media.jai.JAI;
import javax.media.jai.KernelJAI;
import javax.media.jai.PlanarImage;
import javax.swing.JFrame;


public class dilateImage {

	public dilateImage() {
		
	}

	
	public static void main(String[] args) {
		PlanarImage imagem = JAI.create("fileload", "matheus.jpg");
		float[] estrutura = {	0, 0, 0, 0, 0, 0, 0,
								0, 1, 1, 1, 1, 1, 0,
								0, 1, 1, 1, 1, 1, 0,
								0, 1, 1, 1, 1, 1, 0,
								0, 1, 1, 1, 1, 1, 0,
								0, 1, 1, 1, 1, 1, 0,
								0, 0, 0, 0, 0, 0, 0};
		
		KernelJAI kernel = new KernelJAI(7, 7, estrutura);
		ParameterBlock p = new ParameterBlock();
		p.addSource(imagem);
		p.add(kernel);
		
		PlanarImage dilatada = JAI.create("dilate", p);
		
		JFrame frame = new JFrame("Dilatada");
		frame.add(new janelasSincronas(imagem, dilatada));
		frame.pack();
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		

	}

}
